package com.edu.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.edu.dao.impl.OrdersDaoImpl;
import com.edu.entity.User;
import com.edu.service.impl.OrdersServiceImpl;

/**
 * Servlet implementation class sendGoods
 */
@WebServlet("/sendGoods")
public class sendGoods extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		HttpSession session = request.getSession();
		User u = (User) session.getAttribute("logInUser");
		OrdersDaoImpl osi = new OrdersDaoImpl();
		int orderId = Integer.parseInt(request.getParameter("orderId"));
		int state = Integer.parseInt(request.getParameter("state"));
		osi.updateOrder(orderId, state);
	}
	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
